export const useStorage = ($storage: any) => {
  const get = (key: string) => {
    let value = $storage.getItem(key);
    try {
      value = JSON.parse(value);
      return value;
    } catch {
      return value;
    }
  };
  const set = (key: string, value: any) => {
    return $storage.setItem(key, value ? JSON.stringify(value) : value);
  };
  const remove = (key: string) => {
    return $storage.removeItem(key);
  };
  return {
    set,
    get,
    remove,
  };
};
